package com.acg.auth.controller;


import com.acg.auth.pojo.SysOperLog;
import com.acg.auth.service.SysOperLogService;
import com.acg.util.Result;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 操作日志记录 前端控制器
 * </p>
 *
 * @author acg
 * @since 2025-08-09
 */
@CrossOrigin("*")
@RestController
@RequestMapping("/acg/oper-log")
public class SysOperLogController {
    @Resource
    private SysOperLogService service;


    /**
     * 用户条件分页查询
     * @return
     */
    @GetMapping("/getPage/{page}/{limit}")
    public Result getPage(@PathVariable Long page,
                          @PathVariable Long limit) {
        // 1、分页条件
        Page<SysOperLog> ipage = new Page<>(page, limit);

        // 2、条件构造
        LambdaQueryWrapper<SysOperLog> lwq = new LambdaQueryWrapper<>();

        lwq.orderByDesc(SysOperLog::getCreateTime);

        // 2 分页查询
        Page<SysOperLog> paged = service.page(ipage,lwq);
        return Result.ok(paged);
    }

}

